package com.ruoyi.center.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.center.mapper.AffiliatedUnitMapper;
import com.ruoyi.center.domain.AffiliatedUnit;
import com.ruoyi.center.service.IAffiliatedUnitService;

/**
 * 依托与共建单位Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-08
 */
@Service
public class AffiliatedUnitServiceImpl implements IAffiliatedUnitService 
{
    @Autowired
    private AffiliatedUnitMapper affiliatedUnitMapper;

    /**
     * 查询依托与共建单位
     * 
     * @param id 依托与共建单位主键
     * @return 依托与共建单位
     */
    @Override
    public AffiliatedUnit selectAffiliatedUnitById(Long id)
    {
        return affiliatedUnitMapper.selectAffiliatedUnitById(id);
    }

    /**
     * 查询依托与共建单位列表
     * 
     * @param affiliatedUnit 依托与共建单位
     * @return 依托与共建单位
     */
    @Override
    public List<AffiliatedUnit> selectAffiliatedUnitList(AffiliatedUnit affiliatedUnit)
    {
        return affiliatedUnitMapper.selectAffiliatedUnitList(affiliatedUnit);
    }

    /**
     * 新增依托与共建单位
     * 
     * @param affiliatedUnit 依托与共建单位
     * @return 结果
     */
    @Override
    public int insertAffiliatedUnit(AffiliatedUnit affiliatedUnit)
    {
        affiliatedUnit.setCreateTime(DateUtils.getNowDate());
        return affiliatedUnitMapper.insertAffiliatedUnit(affiliatedUnit);
    }

    /**
     * 修改依托与共建单位
     * 
     * @param affiliatedUnit 依托与共建单位
     * @return 结果
     */
    @Override
    public int updateAffiliatedUnit(AffiliatedUnit affiliatedUnit)
    {
        return affiliatedUnitMapper.updateAffiliatedUnit(affiliatedUnit);
    }

    /**
     * 批量删除依托与共建单位
     * 
     * @param ids 需要删除的依托与共建单位主键
     * @return 结果
     */
    @Override
    public int deleteAffiliatedUnitByIds(Long[] ids)
    {
        return affiliatedUnitMapper.deleteAffiliatedUnitByIds(ids);
    }

    /**
     * 删除依托与共建单位信息
     * 
     * @param id 依托与共建单位主键
     * @return 结果
     */
    @Override
    public int deleteAffiliatedUnitById(Long id)
    {
        return affiliatedUnitMapper.deleteAffiliatedUnitById(id);
    }
}
